﻿using Orchard;
using Orchard.Data.Migration;
using System;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.Environment;
namespace Mod.Search
{
    public class Migrations : DataMigrationImpl
    {
        private Work<WorkContext> workContext;

        public Migrations(Work<WorkContext> workContext)
        { 
            this.workContext = workContext;
        }

        public int Create() 
        {
            MigrationTasks.SearchSettings.CreateSearchSettingsRecord(this.SchemaBuilder);

            return 1; 
        }

        public int UpdateFrom1() 
        {
            MigrationTasks.SearchSettings.SetDefaultValueForSettings(this.workContext.Value);

            return 2;
        }

    }
}